<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE >
<html>
<head>
<base href="<%=basePath%>">
<title>JSON&Ajax测试</title>
<script type="text/javascript" src="<%=basePath %>js/jquery.min.js"></script>
<script type="text/javascript">
    	
    		$(function(){
    		
    			$.post("dmidemo!list.action",  function(data){
    					// 循环输出到页面上
    					// 先删除之前如果已经放在页面上的元素
    					$("#newsTab>tr:gt(0)").remove();
    					for(var i=0;i<data.length;i++){
    						$("#newsTab").append("<tr><td>"+data[i].number+"</td><td>"+data[i].title+"</td></tr>");
    					}
    			}, "json");
    		});
    
    </script>
</head>

<body>

	<table border="1" id="newsTab" width="100%">
		<tr>
			<td>新闻编号</td>
			<td>新闻标题</td>
		</tr>
	</table>


</body>
</html>
